package com.hc.accountservice.mapper;

import com.hc.entity.Order;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

/**
 * @BelongsProject: hc
 * @BelongsPackage: com.hc.accountservice.mapper
 * @Author: WY
 * @CreateTime: 2022-10-19  18:53
 * @Descriprion: 订单查询mapper
 * @Version: 1.0
 **/
public interface OrderMapper {

    @Select("select o.originalprice,o.num,s.name,g.price,g.picture from " +
            "hc_order o,hc_shop s,hc_goods g " +
            "where o.id=#{id} and o.goods_id=g.id and o.shop_id=s.id")
    @Results(
            {
                    @Result(column = "id",property = "id",id = true),
                    @Result(column = "originalprice",property = "originalprice"),
                    @Result(column = "num",property = "num"),
                    @Result(column = "price",property = "price"),
                    @Result(column = "picture",property = "picture")

            }
    )
    Order findById(int id);
}
